package cn.net.cfss.fgbp.api.console.dto;

import cn.net.cfss.fgbp.api.console.constant.MenuFlagEnum;
import cn.net.cfss.fgbp.api.console.constant.MenuTypeEnum;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.FgbpEnumSerializer;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.List;

@Table(name = "t_sys_menu")
public class SysMenuDto extends BaseDto {
    /**
     * 父菜单
     */
    @Column(name = "PARENT_ID")
    private Long parentId;

    /**
     * 菜单名称
     */
    @Column(name = "MENU_NAME")
    private String menuName;

    /**
     * 菜单权限标识
     */
    @Column(name = "PERMISSION")
    private String permission;

    /**
     * 前端URL
     */
    @Column(name = "URL")
    private String url;

    /**
     * 图标
     */
    @Column(name = "ICON")
    private String icon;

    /**
     * 排序值
     */
    @Column(name = "SORT")
    private Integer sort;

    /**
     * 菜单类型(0-菜单;1-按钮)
     */
    @Column(name = "MENU_TYPE")
    @JSONField(serializeUsing = FgbpEnumSerializer.class)
    private MenuTypeEnum menuType;

    /**
     * 备注
     */
    @Column(name = "REMARK")
    private String remark;

    /**
     * 前端主键
     */
    @Column(name = "COMPONENT")
    private String component;

    /**
     * 后台接口URL
     */
    @Column(name = "INTERFACE_URL")
    private String interfaceUrl;

    /**
     * 菜单标记
     */
    @Column(name = "MENU_FLAG")
    @JSONField(serializeUsing = FgbpEnumSerializer.class)
    private MenuFlagEnum menuFlag;

    @Transient
    private List<SysMenuDto> child;

    @Transient
    private SysMenuDto parent;

    /**
     * 获取父菜单
     *
     * @return PARENT_ID - 父菜单
     */
    public Long getParentId() {
        return parentId;
    }

    /**
     * 设置父菜单
     *
     * @param parentId 父菜单
     */
    public void setParentId(Long parentId) {
        this.parentId = parentId == null ? null : parentId;
    }

    /**
     * 获取菜单名称
     *
     * @return MENU_NAME - 菜单名称
     */
    public String getMenuName() {
        return menuName;
    }

    /**
     * 设置菜单名称
     *
     * @param menuName 菜单名称
     */
    public void setMenuName(String menuName) {
        this.menuName = menuName == null ? null : menuName.trim();
    }

    /**
     * 获取菜单权限标识
     *
     * @return PERMISSION - 菜单权限标识
     */
    public String getPermission() {
        return permission;
    }

    /**
     * 设置菜单权限标识
     *
     * @param permission 菜单权限标识
     */
    public void setPermission(String permission) {
        this.permission = permission == null ? null : permission.trim();
    }

    /**
     * 获取前端URL
     *
     * @return URL - 前端URL
     */
    public String getUrl() {
        return url;
    }

    /**
     * 设置前端URL
     *
     * @param url 前端URL
     */
    public void setUrl(String url) {
        this.url = url == null ? null : url.trim();
    }

    /**
     * 获取图标
     *
     * @return ICON - 图标
     */
    public String getIcon() {
        return icon;
    }

    /**
     * 设置图标
     *
     * @param icon 图标
     */
    public void setIcon(String icon) {
        this.icon = icon == null ? null : icon.trim();
    }

    /**
     * 获取排序值
     *
     * @return SORT - 排序值
     */
    public Integer getSort() {
        return sort;
    }

    /**
     * 设置排序值
     *
     * @param sort 排序值
     */
    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public MenuTypeEnum getMenuType() {
        return menuType;
    }

    public void setMenuType(MenuTypeEnum menuType) {
        this.menuType = menuType;
    }

    /**
     * 获取备注
     *
     * @return REMARK - 备注
     */
    public String getRemark() {
        return remark;
    }

    /**
     * 设置备注
     *
     * @param remark 备注
     */
    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    public List<SysMenuDto> getChild() {
        return child;
    }

    public void setChild(List<SysMenuDto> child) {
        this.child = child;
    }

    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }

    public SysMenuDto getParent() {
        return parent;
    }

    public void setParent(SysMenuDto parent) {
        this.parent = parent;
    }

    public String getInterfaceUrl() {
        return interfaceUrl;
    }

    public void setInterfaceUrl(String interfaceUrl) {
        this.interfaceUrl = interfaceUrl;
    }

    public MenuFlagEnum getMenuFlag() {
        return menuFlag;
    }

    public void setMenuFlag(MenuFlagEnum menuFlag) {
        this.menuFlag = menuFlag;
    }
}
